package com.atguigu.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

@RestController
@Slf4j
@RequestMapping("/consumer")
public class ConsumerController {
	@Value("${server-url.nacos-payment}")
	private String nacosPayment;
	
	@Autowired
	private RestTemplate restTemplate;
	
	@GetMapping("/payment/{id}")
	public String getPayment(@PathVariable("id")Long id){
		return restTemplate.getForObject(nacosPayment + "/payment/" + id,String.class);
	}
}
